package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	NameList := []string{
		"guanxueye", "wangyalin", "qiqianxu", "wanghao",
	} //定义名单切片
	var choice string
	for {
		fmt.Println("按任意键进行抽取，按q键退出")
		fmt.Scanln(&choice)
		if choice == "q" || choice == "Q" {
			break
		}
		rand.Seed(time.Now().UnixNano())     //给随机种子赋值
		RanArray := rand.Intn(len(NameList)) //产生名单切片下标范围内的随机数
		fmt.Println("进行回答问题的是:", NameList[RanArray])
		NameList = append(NameList[:RanArray], NameList[RanArray+1:]...)
	} //产生无限次抽取
}
